package com.readaloud.hibernate.user;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

@Entity
public class Author extends Users implements Serializable{

	/*@Id @GeneratedValue(strategy = GenerationType.AUTO)
	private int authorId;*/
	private String authorName;
	private String biography;
	
	@OneToMany(mappedBy = "authorObject",cascade = CascadeType.ALL,fetch=FetchType.EAGER)
	@NotFound(action = NotFoundAction.IGNORE)
	private Collection<Books> book = new ArrayList<Books>();


	public Collection<Books> getBook() {
		return book;
	}

	public void setBook(Collection<Books> book) {
		this.book = book;
	}

	public String getBiography() {
		return biography;
	}

	public void setBiography(String biography) {
		this.biography = biography;
	}

	public String getAuthorName() {
		return authorName;
	}

	public void setAuthorName(String authorName) {
		this.authorName = authorName;
	}
	
}
